package com.dyh.quickdemo.whenThen;

import org.junit.jupiter.api.Test;
import org.springframework.util.StringUtils;

import java.util.Objects;
import java.util.function.Function;
import java.util.function.Predicate;

/*
@Author=Joey Wheeler
@Date=2021/3/5 16:15
*/
public class IfOpTest{

    @Test
    public void test(){
        System.out.println(
                IfOp.from("111").orElse("222")
        );

        System.out.println(
                IfOp.from("11")
                        .when(e-> !StringUtils.isEmpty(e))
                        .then(e->e+"!")
                        .when(e->e.length()<10)
                        .then(e->e+"!")
                        .orElse("空")
        );

        /*
        *
        *  if(xxx)
        *   if(nbbb)
        *       if (xxx)
        *           return xxx
        *
        * */
    }
}
